<template>
	<view>
		<home-search></home-search>
		<home-swiper></home-swiper>
		<home-grid></home-grid>
		<image class="bar_box" src="/static/中间.jpg" mode="widthFix"></image>
		<!-- <view class="tabs_box">
			<lyz-tabs type="scroll" v-model="tabIndex" @change="(item) => getTab(item.id)" :columns="[{title:nav[0].name,id:nav[0].id},{title:nav[1].name,id:nav[1].id},{title:nav[2].name,id:nav[2].id},{title:nav[3].name,id:nav[3].id},{title:nav[4].name,id:nav[4].id}]"></lyz-tabs>
		</view> -->
		<home-flow></home-flow>
	</view>
</template>

<script setup>
	import homeSearch from './components/home-search.vue'
	import homeSwiper from './components/home-swiper.vue'
	import homeGrid from './components/home-grid.vue'
	import homeFlow from './components/home-flow.vue'
	import http from '../../../common/http.js'
	import {ref} from 'vue'
	import { onMounted,onBeforeMount } from 'vue'

	const nav=ref() //导航分类的接收
	let  id=ref() //传递的id
	let tabIndex = ref(0)
	const getTab = (idd) => {
		id.value=idd
	}
	
	onBeforeMount(async ()=>{
		uni.login({
			provider:"weixin",
			success:function(res){
				http({
					url:`/user-api/app-api/user/wx/login`,
					method:"post"
				},{'code': res.code}).then(res=>{
					console.log(res.data.token);
					uni.setStorageSync('token', res.data.token);
					uni.setStorageSync('openid', res.data.openid);
					uni.setStorageSync('session_key', res.data.session_key);
				})
				
			}
			
		})
		// await http({
		// 	url:`/goods-api/app-api/categories`,
		// 	method:"get"
		// },{}).then(res=>{
			
		// 	nav.value=res.data
		// 	console.log(nav.value);
		// })
	})
</script>

<style lang="scss" scoped>
.bar_box {
	width: 100%;
	height: 140rpx;
}
.tabs_box {
	padding: 24rpx 0;
}
</style>
